{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  GUI编程(Tkinter)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "\n",
    "\n",
    "Python GUI编程(Tkinter)\n",
    "Python 提供了多个图形开发界面的库，几个常用 Python GUI 库如下：\n",
    "\n",
    "Tkinter： Tkinter 模块(Tk 接口)是 Python 的标准 Tk GUI 工具包的接口 .Tk 和 Tkinter 可以在大多数的 Unix 平台下使用,同样可以应用在 Windows 和 Macintosh 系统里。Tk8.0 的后续版本可以实现本地窗口风格,并良好地运行在绝大多数平台中。\n",
    "\n",
    "wxPython：wxPython 是一款开源软件，是 Python 语言的一套优秀的 GUI 图形库，允许 Python 程序员很方便的创建完整的、功能健全的 GUI 用户界面。\n",
    "\n",
    "Jython：Jython 程序可以和 Java 无缝集成。除了一些标准模块，Jython 使用 Java 的模块。Jython 几乎拥有标准的Python 中不依赖于 C 语言的全部模块。比如，Jython 的用户界面将使用 Swing，AWT或者 SWT。Jython 可以被动态或静态地编译成 Java 字节码。\n",
    "\n",
    "\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "\n",
    "\n",
    "Tkinter 编程\n",
    "Tkinter 是 Python 的标准 GUI 库。Python 使用 Tkinter 可以快速的创建 GUI 应用程序。\n",
    "\n",
    "由于 Tkinter 是内置到 python 的安装包中、只要安装好 Python 之后就能 import Tkinter 库、而且 IDLE 也是用 Tkinter 编写而成、对于简单的图形界面 Tkinter 还是能应付自如。\n",
    "\n",
    "注意：Python3.x 版本使用的库名为 tkinter,即首写字母 T 为小写。\n",
    "\n",
    "\n",
    "'''"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tkinter\n",
    "top = tkinter.Tk()\n",
    "# 进入消息循环\n",
    "top.mainloop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "from tkinter import *\n",
    "\n",
    "root  = Tk()                  # 创建窗口对象的背景色\n",
    "li = ['C','python','java','php']\n",
    "movie  = ['CSS','jQuery','Bootstrap']\n",
    "\n",
    "listTab1 = Listbox(root)     #  创建两个列表组件\n",
    "listTab2 = Listbox(root)\n",
    "\n",
    "for item in li:\n",
    "    listTab1.insert(0,item)   # 第一个小部件插入数据\n",
    "    \n",
    "for item in movie:\n",
    "    listTab2.insert(0,item)  # 第二个小部件插入数据\n",
    "    \n",
    "    \n",
    "listTab1.pack()               # 将小部件放置到主窗口中\n",
    "listTab2.pack()\n",
    "\n",
    "root.mainloop()             # 进入消息循环\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
